#require 'pry'

When(/^I launch XML Editor$/) do
  run_simple(unescape("ruby ../../xml_editor.rb"), false)
end

When(/^I run XML Editor interactively$/) do
  cmd = "ruby -X ../.. xml_editor.rb"
  run_interactive(unescape(cmd))
end

When(/^I launch XML Editor interactively$/) do
  cmd = "ruby ../../xml_editor.rb"
  run_interactive(unescape(cmd))
end

Then /^I close the stdin stream$/ do
  #binding.pry
  @interactive.stdin.close()
end

Then /^I clear the stdout stream$/ do
  #binding.pry
  #p "//////////"
  #p @interactive.stdout
  #@interactive.instance_variable_set(:@output_cache, "")
  #binding.pry
end

When(/^I type the file name "(.*?)"$/) do |arg1|
  type("../../")  
end

Then(/^the cursor should be `(.*?)`$/) do |arg1|
  step %{I type "b"}
  step %{I close the stdin stream}
  expected = "~ node at cursor:\n\n#{arg1}"
  assert_partial_output(expected, all_output)
 # step %{the output should contain /#{arg1}/}
end

# When /^I type "([^"]*)"$/ do |input|
  # type(input)
# end

When(/^I type "(.*?)" in succession$/) do |inputs|
  inputs.split(',').each do |input|
    type(input)
  end
end
